<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="ele">   
    <script>
        const ele=document.getElementById('ele');
        const xyInput=new Proxy(ele,{
            set(target,prop,value){
                console.log(target,prop,value);
                if(prop==='value'){
                    target.dispatchEvent(new CustomEvent('change'));
                }
                target[prop]=value;
                return Reflect.set(target,prop,value);
                // return true;
            },
            get(target,prop){
                return Reflect.get(target,prop);
                // return target[prop];
            }
        })
        ele.addEventListener('change',()=>{
            document.body.appendChild(document.createTextNode('变化了'));
        })
        xyInput.value = '喵喵';
    </script>
</body>
</html>